<template>
  <div :class="{'hot-switch': true, disabled}"
       @click="onClick">
    <i :class="`iconfont ${icon}`"></i>
  </div>
</template>

<script lang="ts"
        setup>
let props = withDefaults(defineProps<{
  icon?: string,
  disabled: boolean
}>(), {
  disabled: true
})

let emit = defineEmits<{
  (event: 'click'): void
}>()

function onClick():void {
  if (props.disabled) return
  emit('click')
}
</script>

<style lang="less"
       scoped>
.hot-switch {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  background-color: #27ba9b;
  cursor: pointer;

  & ~ .hot-switch {
    margin-left: 5px;
  }

  &.disabled {
    cursor: not-allowed;
    background-color: #ccc;
  }
}
</style>